<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/easycommon.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>合同签署</title>
    <meta charset="utf-8">
    <style>
    	table{font-size:14px}
    	a{text-decoration:none}
    </style>
    <script>
    $(function(){
    	var datagrid; //定义全局变量datagrid
        var editRow = undefined; //定义全局变量：当前编辑的行
        datagrid = $('#reportTable').datagrid({
    		rownumbers:true,
    		//singleSelect:true,
    		//pagination:true,
    		//pageSize:30,
    		//singleSelect:false,
    		fit: true, //datagrid自适应宽度
            fitColumn: false, //列自适应宽度
            striped: true, //行背景交换
            nowap: true, //列内容多时自动折至第二行
            border: false,
            //idField: 'id', //主键
    		url:"${path}/report/queryHtmxList",
    		toolbar:'#tb',
    		columns:[[
    			{field:'manager',title:'员工',width:100},
    			{field:'yeartotal',title:'年度',width:100,formatter:yearfun},
				{field:'month1',title:'一月',width:100,formatter:month1fun},
    			{field:'month2',title:'二月',width:100,formatter:month2fun},
    			{field:'month3',title:'三月',width:100,formatter:month3fun},
    			{field:'month4',title:'四月',width:100,formatter:month4fun},
    			{field:'month5',title:'五月',width:100,formatter:month5fun},
    			{field:'month6',title:'六月',width:100,formatter:month6fun},
    			{field:'month7',title:'七月',width:100,formatter:month7fun},
    			{field:'month8',title:'八月',width:100,formatter:month8fun},
    			{field:'month9',title:'九月',width:100,formatter:month9fun},
    			{field:'month10',title:'十月',width:100,formatter:month10fun},
    			{field:'month11',title:'十一月',width:100,formatter:month11fun},
    			{field:'month12',title:'十二月',width:100,formatter:month12fun}
    		]]
    		//queryParams: {querydate: $('#querydate').val()}//查询参数
    	});
        $('#querydate').bind('focus',function(){ WdatePicker({ dateFmt: 'yyyy', autoPickDate: true });});
        $('#querydate').val(new Date().format('yyyy'));
        $('#searchbth').on('click',function(e){
        	datagrid.datagrid("load",{querydate: $('#querydate').val()});
        });
    })
    
    function yearfun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'nd\',\''+row.year+'\')">'+val+'</a>';}
    function month1fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-01\')">'+val+'</a>';}
    function month2fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-02\')">'+val+'</a>';}
    function month3fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-03\')">'+val+'</a>';}
    function month4fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-04\')">'+val+'</a>';}
    function month5fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-05\')">'+val+'</a>';}
    function month6fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-06\')">'+val+'</a>';}
    function month7fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-07\')">'+val+'</a>';}
    function month8fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-08\')">'+val+'</a>';}
    function month9fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-09\')">'+val+'</a>';}
    function month10fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-10\')">'+val+'</a>';}
    function month11fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-11\')">'+val+'</a>';}
    function month12fun(val,row,index){return '<a href="#" onclick="showDetail(\''+row.managerId+'\',\'yd\',\''+row.year+'-12\')">'+val+'</a>';}
    
    function showDetail(userId,nb_yd,dateTime){
    	var url = "${path}/report/htmxDetail?userId="+userId+"&nd_yd="+nb_yd+"&dateTime="+dateTime;
		layIndex = layer.open({
			title:"明细",
			type: 2,
			fix: false,
	        maxmin: true,
	        area: ['870px', '670px'],
		    content: url,
		    cancel: function(index){
	        }
		});
    }
    </script>
</head>
<body>
	<table id="reportTable" title="合同签署" class="easyui-datagrid" style="width:850px;height:450px"
			singleSelect="true" iconCls="icon-save">
	</table>
	
	<div id="tb" style="padding:2px 5px;padding-left:10px">
        	年度: <input type="text" class="mytextbox" id="querydate">
        <a id="searchbth" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
    </div>
</body>
</html>
